<!doctype html>
<html lang="en">
	<head>
		<title>Tween.js / array interpolation</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<style>
			body {
				margin: 0px;
			}

			#target {
				font-size: 13px;
				padding: 0px 32px;
			}
		</style>
		<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
	</head>
	<body>
		<div id="info" style="position: relative">
			<h1><a href="http://github.com/tweenjs/tween.js">tween.js</a></h1>
			<h2>06 _ array interpolation</h2>
			<p>The different interpolations if arrays are used as values.</p>
		</div>

		<div id="target"></div>

		<script type="module">
			import {createPath, xA, x0, yA, y0} from './js/createPath.js'
			import * as TWEEN from '../dist/tween.esm.js'

			const group = new TWEEN.Group()

			const target = document.getElementById('target')
			if (!target) throw 'missing element'

			target.appendChild(createPath(group, 'Linear', TWEEN.Interpolation.Linear))
			target.appendChild(createPath(group, 'Bezier', TWEEN.Interpolation.Bezier))
			target.appendChild(createPath(group, 'CatmullRom', TWEEN.Interpolation.CatmullRom))

			target.appendChild(document.createElement('br'))

			xA.push(x0)
			yA.push(y0)

			target.appendChild(createPath(group, 'start === end', TWEEN.Interpolation.Linear))
			target.appendChild(createPath(group, '', TWEEN.Interpolation.Bezier))
			target.appendChild(createPath(group, '', TWEEN.Interpolation.CatmullRom))

			animate()

			function animate(time) {
				requestAnimationFrame(animate)

				group.update(time)
			}
		</script>
	</body>
</html>
